package com.GoldMiner.util;

import java.awt.*;

/**
 * 抓取的物体类
 */
public class Item {
    //物体的坐标
    private int x;
    private int y;
    //物体的大小
    private int width;
    private int height;
    private Image img;//抓取的物体图片
    private boolean isCollected = false; //是否已经被抓取
    private int m; //物体的质量
    private int count; //物体的积分

    public Item() {
    }

    //绘制物体
    public void paint(Graphics g) {
        g.drawImage(img, x, y, width, height, null);
    }

    //检测物体矩形重合
    public Rectangle getRect() {
        return new Rectangle(x, y, width, height);
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public Image getImg() {
        return img;
    }

    public void setImg(Image img) {
        this.img = img;
    }

    public String toString() {
        return "Item{x = " + x + ", y = " + y + ", width = " + width + ", height = " + height + ", img = " + img + "}";
    }

    public boolean isIsCollected() {
        return isCollected;
    }

    public void setIsCollected(boolean isCollected) {
        this.isCollected = isCollected;
    }

    public int getM() {
        return m;
    }

    public void setM(int m) {
        this.m = m;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}
